package van.planifolia.methodref;

import java.util.function.Supplier;

/**
 * Created by Intellij IDEA<br>
 *
 * @author Planifolia.Van
 * @version 1.0
 * @date 2022/11/4 16:53
 */
public class MethodRef2 {
    public static void main(String[] args) {
        // 先构建一个实例对象
        People people = new People("向晚");
        // 因为这个是没参数有返回值的我们不妨使用生产者函数式接口
//        Supplier<String> supplier = ()->people.getName();
        Supplier<String> supplier = people::getName;
        System.out.println(supplier.get());
    }
}
class People{
    String name;
    public People(String name) { this.name = name; }
    public String getName(){ return this.name; }
}